//
//  EatClassPageTableViewCell.swift
//  01 联系
//
//  Created by 盈灿－刘鑫奇 on 16/2/16.
//  Copyright © 2016年 盈灿－刘鑫奇. All rights reserved.
//

import UIKit

class EatClassPageTableViewCell: UITableViewCell {

    @IBOutlet weak var bgImage: UIImageView!
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var detailLabel: UILabel!
    @IBOutlet weak var bgView: UIView!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        bgView.alpha = 0.6



    }
    
    func createData(Model:EatClassPageModel){
        
        bgImage.sd_setImageWithURL((NSURL(string: Model.image)), placeholderImage: UIImage(named: ""))
        
//        Model.series_name.lengthOfBytesUsingEncoding(NSUTF8StringEncoding)
        let source = (Model.series_name as NSString).substringWithRange(NSMakeRange(1, (Model.series_name as NSString).length - 1))
        let str = "#"
        
        let subRange = (source as NSString).rangeOfString(str)   //子范围
        titleLabel.text = (source as NSString).substringFromIndex(subRange.location + 1)

        detailLabel.text = (source as NSString).substringWithRange(NSMakeRange(0, subRange.location)) + " " + String(Model.episode) + "/" + String(Model.episode_sum) + "集 " + String(Model.play) + "人做过"
        
        titleLabel.adjustsFontSizeToFitWidth = true
        detailLabel.adjustsFontSizeToFitWidth = true

        
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
